<template>
   <div id="querylist">
      <v-table
          :pageSize="pageSize"
          :page="page"
          :tableConfig="tableConfig"
          :tableData="tableData"
          :total="total"
          @findData="getTableData"
          @getTableData="getTableData"
          @searhData="searhData"
          @selectData="selectData"
          @setdialog="setdialog"
          @upData="getTableData"
          ref="table"
      ></v-table>
   </div>
</template>

<script>
import table from "commons/Table";

export default {
   name: "querylist",
   data() {
      return {
         tableConfig: [
            {
               label: "ID",
               prop: "id",
               input: "input",
            },
            {
               label: this.$t('security.desc'),
               prop: "desc",
               input: "input",
            },
            {
               label: this.$t('out.history'),
               prop: "hy",
               input: "input",
            },
         ],
         tableData: [],
         pageSize: 10,
         page: 1,
         total: 10,

         users: "",
         whseid: ""
      }
   },
   methods: {
      selectData(data) {
         this.tableSelectData = data;
      },
      async getTableData(page, data) {
          try {
             this.loading = true;
             let res = await this.$api.post(`/queryAltskuList/${page}`, data);
             
                this.tableData = res.page.list;
                this.page = res.page.curpage;
                this.pageSize = res.page.pageSize;
                this.total = res.page.total;
          } catch (e) {
             this.$message.error(e);
          } finally {
             this.loading = false;
          }
      },
      //搜索的值
      searhData(data, up) {
         if (!up) {
            this.tableSearhData = data;
         } else {
            this.tableSearhData = data;
            this.getTableData(1, this.tableSearhData);
         }
      },
      setdialog(data) {
         this.$store.commit("setRouteData", data);
         this.$router.push({ name: 'detaillist' });
      },
   },
   mounted() {
      this.users = this.$route.query.users;
      this.whseid = this.$route.query.whseid;
   },
   components: {
      "v-table": table
   }
}
</script>

<style scoped>
#querylist {
   width: 100%;
   height: 100%;
}

</style>
